'''
while 循环
'''
n = 100
sum = 0
counter = 0
while counter < n:
    counter = counter + 1
    sum = sum + counter

print("1到100的和为：",sum)

'''
for 循环
'''
list = ['hello', 'world', 1, 2, 3]
for x in list:
    print(x, end=' ')
print()

'''
range()函数
'''
for x in range(5):
    print(x, end=" ")
print()

for x in range(5, 9):
    print(x, end=" ")
print()

for x in range(0, 10, 3):
    print(x, end=" ")
print()

l = ['h', 1, 2]
for x in range(len(l)):
    print(x, l[x])
